package com.matt.repository.news;

import com.matt.domain.news.SystemNotificationMenu;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * *******************************
 * Created by lch.
 * form com.matt
 * on 2018/11/28
 * *******************************
 */
public interface SystemNotificationMenuRepository extends JpaRepository<SystemNotificationMenu, String>, JpaSpecificationExecutor<SystemNotificationMenu> {

    List<SystemNotificationMenu> findBySystemNotificationId(String systemNotificationId);

    @Transactional
    @Modifying
    @Query(value = "delete from system_notification_menu where systemNotificationId =:systemNotificationId ",nativeQuery = true)
    int deleteBySystemNotificationId(@Param("systemNotificationId") String systemNotificationId);

}
